"""
Application entry point for running the server
This script should be run from the project root directory
"""
import sys
import os
from pathlib import Path

# Ensure the project root is in the Python path
project_root = Path(__file__).parent
sys.path.insert(0, str(project_root))

if __name__ == "__main__":
    import uvicorn
    import multiprocessing
    from config.settings import settings

    # Fix for Windows multiprocessing issue
    multiprocessing.freeze_support()

    # Always use import string for proper reload/workers support
    uvicorn.run(
        "src.main:app",
        host=settings.host,
        port=settings.port,
        reload=settings.reload,
        log_level=settings.log_level.lower()
    )
